style(lib): Address clippy panics and missing_panics_doc lints - #4191
Open
Siech0 wants to merge 1 commit into
Open
style(lib): Address clippy panics and missing_panics_doc lints#4191Siech0 wants to merge 1 commit into
Siech0 wants to merge 1 commit into
Conversation
Siech0
force-pushed
the
style/address-clippy-panic
branch
2 times, most recently
from
September 11, 2026 03:55
49ceb1c to
54b211d
Compare
seanmonstar
requested changes
Sep 11, 2026
seanmonstar
left a comment
Member
There was a problem hiding this comment.
Thanks for taking this on! 2 notes inline.
| ready!(conn | ||
| .as_mut() | ||
| .expect("client connection polled after completion") | ||
| .unwrap_or_else(|| unreachable!("client connection polled after completion")) |
Member
There was a problem hiding this comment.
I think using expect in this case, polling a completed future, is normal. I wouldn't call this unreachable, because if the user does so, it sounds like we made a mistake.
But the docs of Future indicate the user should not do so. I don't think we need to document that behavior.
Author
There was a problem hiding this comment.
Fixed. Thanks for the prompt review!
Please note, on rebase I hit more lints and have updated accordingly.
| /// | ||
| /// # Panics | ||
| /// | ||
| /// This future will panic if polled after it has already completed. |
Member
There was a problem hiding this comment.
Same here, this is basically expected from the Future docs, we can leave it off.
Siech0
marked this pull request as draft
September 11, 2026 15:15
Siech0
force-pushed
the
style/address-clippy-panic
branch
2 times, most recently
from
September 11, 2026 15:46
d59e9ae to
30577fc
Compare
Siech0
marked this pull request as ready for review
September 11, 2026 15:47
Siech0
force-pushed
the
style/address-clippy-panic
branch
from
September 11, 2026 15:47
30577fc to
d5729db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Towards #4071
Most of the panics are structurally unreachable, I attempted to reproduce them with adversarial workflows (panics, malformed inputs, etc) and I believe they are truly unreachable so I have marked them as
unreachable!(...). This will still panic if it is hit, but it makes the intent clear and avoids needing a panic doc.Two panics were reproducible and have had their panic docs written.
Connection::without_shutdown @ src/server/conn/http1.rs:184ReadBufCursor::advance @ src/rt/io.rs:346Both cases are pretty silly to ever hit, but documentation is free.